Optimization of public transport routes during road interruptions by Cascais Municipality
Start coding here! 🐱🏍
Create the necessary subsections (e.g. EDA, different experiments, etc..) and markdown cells to include descriptions of your work where you see fit. Comment your code.
All new subsections must start with three hash characters.
Pro-tip 1: Don't forget to make the jury's life easier. Remove any unnecessary prints before submitting the work. Hide any long output cells (from training a model for example). For each subsection, have a quick introduction (justifying what you are about to do) and conclusion (results you got from what you did).
Pro-tip 2: Have many similiar graphs which all tell the same story? Add them to the appendix and show only a couple of examples, with the mention that all the others are in the appendix.
Optimization of public transport in cities is without a question a hot topic. The perfomance of the public transport has direct consequences not only in the quality of life of the citizens of each city (because of connectivity), but also in the overall CO2 emissions of an entire country. It is a big challenge to focus on. To solve a Vehicle Routing Problem (VRP) with the size of an entire city is a NP-Hard problem. This means: Easy to check once it is solved, but very difficult and time consuming to solve it to optimality (if an optimal solution can actually be found). Because of this we decided to go step by step, and even before considering to go with heuristics and other methodologies, our approach and methodology was based on Divide and Conquer. Our idea aims to go from general to specific, and the methodology is shown below.
From general to specific, the methodology follows the following:
# Libraries
import sys
from pathlib import Path
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
import seaborn as sns
import geopandas as gp
import geojson
from shapely.geometry import LineString, shape
import fiona
import contextily as cx
from fastai.imports import *
import gtfs_kit as gk
import folium
import json
import gtfsutils
import gtfsutils.routes
import gtfsutils.filter
from geojson import Feature, FeatureCollection, Point
from obspy.geodetics import degrees2kilometers
from geopy import distance
from collections import defaultdict
import warnings
warnings.filterwarnings("ignore")
The following files were preprocessed as described:
Caiscais is a city in Portugal (near Lisbon), which has 987 registered different streets as it can be seen below.
geo_data = gp.read_file('eixodevia.geojson',
ignore_geometry = False,
encoding = 'utf-8')
geo_data.explore(color = 'darkslategray')